﻿$(document).ready(function (){

$('.DeleteCourse').click(function (evento) {
        evento.preventDefault();
        var Answer = confirm('¿ Desea eliminar este registro ?');

        if (Answer == false) {
            return false;
        }
        else {

            var s = this.href;
            var Half = s.split('?');
            var obj = this;

            $.ajax({
                url: "../Course/DeleteCourse",
                cache: false,
                type: "POST",
                dataType: "html",
                data: Half[1],
                success: function (html) {
                    if (html == "True") {

                        $(obj).parents('tr:first').hide();

                    }
                }
            });

        }

    });

    $('.DeleteStudent').click(function (evento) {
        evento.preventDefault();
        var Answer = confirm('¿ Desea eliminar este registro ?');

        if (Answer == false) {
            return false;
        }
        else {

            var s = this.href;
            var Half = s.split('?');
            var obj = this;

            $.ajax({
                url: "../Student/DeleteStudent",
                cache: false,
                type: "POST",
                dataType: "html",
                data: Half[1],
                success: function (html) {
                    if (html == "True") {

                        $(obj).parents('tr:first').hide();

                    }
                }
            });

        }

    });

    $('.DeleteInstructor').click(function (evento) {
        evento.preventDefault();
        var Answer = confirm('¿ Desea eliminar este registro ?');

        if (Answer == false) {
            return false;
        }
        else {

            var s = this.href;
            var Half = s.split('?');
            var obj = this;

            $.ajax({
                url: "../Instructor/DeleteInstructor",
                cache: false,
                type: "POST",
                dataType: "html",
                data: Half[1],
                success: function (html) {
                    if (html == "True") {

                        $(obj).parents('tr:first').hide();

                    }
                }
            });

        }

    });


//    $("#BtnSearch").click(function(){
//        $(function () {
//            $("#paginDiv").pagination(); 
//        });
//  });


    $('#BtnBack').click(function () {
        history.back();

    });
});

